home *** CD-ROM | disk | FTP | other *** search
-
- OVERVIEW:
- ---------
- This is a handy program that I wrote in Clipper 5.01. It takes an ASCII
- file for input and creates a dBase III+ or Clipper .DBF file as output.
-
- "Why don't you just use the dBase APPEND FROM ... SDF command, stupid!?"
- you may ask. Well there are several reasons why TEXT2DBF is better in
- many situations:
-
- 1) You may not have dBase or FoxPro handy
- 2) You may want to do more formatting or conversion than is possible
- with APPEND FROM ... SDF
- 3) You might not want all of the data in the text file
- 4) You may want to append data into an existing database that is not
- in the same format as the text file
- 5) You can run TEXT2DBF from a batch file for automated procedures
-
- The power of TEXT2DBF lies in the Conversion Definition Files (.CDF) that
- specify how the text information is extracted and formatted for the .DBF
- output file. Take a look at the sample TEST.CDF to get an idea of what a
- CDF looks like. Basically, you specify the file structure of the output
- .DBF file along with standard Clipper 5.01 expressions to retrieve and
- format the text data. Below is a sample CDF file for a simple 3 field file.
-
- ACCOUNT |C| 7| 0| SUBSTR(cRec,1,7)
- AMOUNT |N| 9| 0| VAL(SUBSTR(cRec,8,9))
- DATE |D| 8| 0| CTOD(SUBSTR(cRec,17,8))
-
- As you can see, you merely specify the field name, type, length, and decimals,
- along with the expression to retrieve/format the text data. In the expression,
- you assume that the variable "cRec" contains one record from the text file.
- Refer to TEST.CDF for more explanation and examples.
-
- Since YOU specify how to extract the data, you can skip any data you don't need,
- format/convert the data to your heart's content, insert data not found in the
- source text file, etc.. To do this kind of formatting with dBase would require
- many MODIFIY STRUCTURE and REPLACE passes through the database - TEXT2DBF
- does it in a single pass!
-
-
-
- RUNNING THE PROGRAM:
- --------------------
- To run the program you must specify the source file, destination file, and
- CDF file:
-
- Example: TEXT2DBF TEST.TXT TEST.DBF TEST.CDF
-
- The .DBF file will be created if neccessary. If the .DBF file already exists,
- the structure will be compared to that in the .CDF file to make sure that the
- file is compatible, then records will be appended into the existing file.
-
-
-
- TECHNICAL DEPARTMENT:
- ---------------------
- TEXT2DBF.EXE requires the Pre-Linked Library (PLL) FULLBASE.PLL. The reason
- FULLBASE.PLL is so large is because it contains ALL of the functions found
- in CLIPPER.LIB and EXTEND.LIB. FULLBASE.PLL needs to reside either in the
- current directory from which TEXT2DBF is executed, somewhere on your path, or
- in the directory specified by the DOS environment variable PLL
- (i.e. SET PLL=C:\CLIPPER5\PLL).
-
- I felt it was better to link the program this way so that ANY clipper function
- would be available for expressions. If you wanted to create a stand-alone .EXE
- file, you need to decide which functions you want to allow for expressions and
- declare them EXTERNAL in TEXT2DBF.PRG so that the linker will pull them into
- the .EXE file.
-
- To compile the file: CLIPPER text2dbf /n /m
- To link using RTlink: RTLINK @text2dbf
-
- TEXT2DBF does extensive checking of the CDF file for errors, if a function is
- referenced that is not found in TEXT2DBF.PRG, CLIPPER.LIB, or EXTEND.LIB, you
- will not be able to process the file. You also will not be able to specify
- invalid field information.
-
- TEXT2DBF has some good examples of how to do low-level file IO in Clipper and
- also demonstrates a good use of codeblocks. The expressions found in the CDF
- files are converted to codeblocks and stored in an array, then each codeblock
- is evaluated in a FOR loop for each text record, and the resulting data is
- stored in the corresponding database field. Cool, huh?
-
-
-
- PATHETIC PLEA FOR DONATIONS DEPARTMENT:
- ---------------------------------------
- I basically wrote this program for my own use and don't know if anybody else
- will want to use it or not. All I ask is that if you do use it and derive any
- benefit from its use, please send a donation of $5.00 or more to:
-
- David Christian
- BITwise Computer Services
- PO BOX 97642
- Raleigh, NC 27624-7642
-
- If you send a check, please make it out to David Christian or David Christian
- dba BITwise Computer Services.
-
- //EOF
-